<template>
  <p-form-model :model="form" :rules="rules" layout="inline">
    <p-form-model-item label="RP名称">
      <p-input v-model="form.name" placeholder="请输入" />
    </p-form-model-item>
    <p-form-model-item label="当前状态">
      <SelectDefault v-model="form.state" code="state" />
    </p-form-model-item>
    <p-form-model-item label="当前节点">
      <SelectDefault v-model="form.node" code="plan_node" />
    </p-form-model-item>
    <p-form-model-item label="销售组织">
      <SelectOrg v-model="form.salesOrganization" />
    </p-form-model-item>
    <p-button type="primary" class="btn-search" @click="handleSearch">
      搜索
    </p-button>
    <p-button @click="handleReset">重置</p-button>
  </p-form-model>
</template>
<script>
const defaultForm = {
  name: '',
  state: '',
  node: '',
  salesOrganization: '',
};
export default {
  data() {
    return {
      col: 4,
      row: 1,
      gutter: 24,
      form: {
        ...defaultForm,
      },
    };
  },
  methods: {
    handleSearch() {
      this.$emit('search', this.form);
    },
    handleReset() {
      this.form = { ...defaultForm };
      this.$emit('search', this.form);
    },
  },
};
</script>

<style lang="less" scoped>
.poros-form {
  padding: 10px 20px;
  width: 100%;
  border-bottom: 1px solid #e5e6e9;
}
.poros-form-item {
  width: 20%;
  margin-bottom: 0;
}
/deep/ .poros-form-item-control-wrapper {
  width: calc(100% - 70px);
}
.btn-search {
  margin-right: 16px;
}
</style>
